package com.dubito.owldemo.ui.lessons

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import com.google.android.material.bottomsheet.BottomSheetBehavior

/**
 * author: liliang
 * date: 12/5/20 7:08 PM
 * desc:
 */
class LessonBottomSheetBehavior<T : View>(context: Context, attrs: AttributeSet?) :
    BottomSheetBehavior<T>(context, attrs) {

    override fun onTouchEvent(parent: CoordinatorLayout, child: T, event: MotionEvent): Boolean {
        if (event.x < child.translationX) {
            return false
        }
        return super.onTouchEvent(parent, child, event)
    }
}